package com.lc.type.impl;

import com.lc.type.TypeHandler;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class IntegerTypeHandler implements TypeHandler<Integer> {

    @Override
    public Integer getColumnValue(ResultSet rs, String columnName) throws SQLException {
        if (rs == null) {
            return null;
        }
        return rs.getInt(columnName);
    }

    @Override
    public void setStatementValue(PreparedStatement ps, int paramIndex, Integer paramValue) throws SQLException {
        ps.setInt(paramIndex, paramValue);
    }
}
